#ifndef BOXRENDERER_H_
#define BOXRENDERER_H_

#include "D3DFlyweight.h"
#include "BlockVertexBufferSorter.h"

class BoxRenderer
{
public:
	static BoxRenderer &GetInstance();
	void Init();
	void Shutdown();
	void Render(const char *_szFileName);

	BlockVertexBufferSorter &GetDefaultSorter() { return sorter; }

	BoxRenderer();
	~BoxRenderer();
private:
	BoxRenderer(const BoxRenderer &);
	BoxRenderer &operator =(const BoxRenderer &);

	D3DXMATRIX view;
	D3DXMATRIX proj;
	IDirect3DTexture9* m_pRenderTarget;
	IDirect3DSurface9* m_pRenderSurface;
	ID3DXRenderToSurface *m_pRenderToSurface;

	BlockVertexBufferSorter sorter;

	D3DXHANDLE m_hWorld;
	D3DXHANDLE m_hView;
	D3DXHANDLE m_hProjection;
	D3DXHANDLE m_hTechnique;
	D3DXHANDLE m_hAlphaTechnique;
	D3DXHANDLE m_hPosition;
};

#endif